package com.google.code.whitetask.old;

/**
 * <p>
 * This is a proxy task to reduce redundant task expressions specified in
 * <code>TaskChain</code>.
 * </p>
 * <p>
 * For example, following code
 * <p>
 * 
 * <pre>
 * chain(new XXTask().caught().asynchronously(),
 *     new YYTask().caught().asynchronously(),
 *     new ZZTask().caught().asynchronously()).execute(context);
 * </pre>
 * 
 * </p>
 * <p>
 * can be replaced as following using <code>TaskProxy</code>
 * <p>
 * 
 * <pre>
 * chain(new XXTask(), new YYTask(), new ZZTask()).proxy(new ExampleProxy())
 *     .execute();
 * 
 * public class ExampleProxy implements TaskProxy {
 *   public TaskResultType execute(Task task, TaskContext context) {
 *     FluentTask fluentTask = (FluentTask) task;
 *     return fluentTask.caught().asynchronously().execute(context);
 *   }
 * }
 * </pre>
 * 
 * </p>
 * 
 * @author minslovey
 */
public interface TaskProxy {
  public TaskResultType execute(Task task, TaskContext context);
}
